package com.szmg.auth.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.szmg.auth.model.Company;
import com.szmg.cloudlive.model.Classes;
import com.szmg.common.BaseDao;

@Component("companyDao")
public class CompanyDao extends BaseDao {

	
	public List<Company> findAllCompany() {
		return this.readSqlSession.selectList("com.szmg.auth.dao.CompanyDao.selectAllCompany");
	}
	
	public List<Company> findCompany(int start,int size,Company company) {
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("start", start);
		map.put("size", size);
		map.put("company", company);
		return this.readSqlSession.selectList("com.szmg.auth.dao.CompanyDao.selectCompany",map);
	}
	
	public void addCompany(Company company){
		writerSqlSession.insert("com.szmg.auth.dao.CompanyDao.addCompany", company);
	}
	
	public Company findCompanyById(int id){
		return readSqlSession.selectOne("com.szmg.auth.dao.CompanyDao.selectCompanyById", id);
	}
	
	public void updateCompany(Company company){
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("company", company);
		writerSqlSession.update("com.szmg.auth.dao.CompanyDao.updateCompany", map);
	}
	
	public void deleteCompanyById(int id){
		writerSqlSession.delete("com.szmg.auth.dao.CompanyDao.deleteCompanyById", id);
	}
}
